//
//  ZPBSecondCollectionViewCell.m
//  WZLProduct
//
//  Created by boys on 16/3/19.
//  Copyright © 2016年 HaiTeng. All rights reserved.
//

#import "ZPBSecondCollectionViewCell.h"

@implementation ZPBSecondCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatimage];
        
    }return self;
}


- (void)creatimage {
    self.img = [[UIImageView alloc] init];
    [self addSubview:_img];
    self.label = [[UILabel alloc] init];
    [self addSubview:_label];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [_img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(25);
        make.centerX.mas_equalTo(self.mas_centerX);
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(-22);
        make.height.mas_equalTo(25);
        
    }];
    
    _img.backgroundColor = [UIColor redColor];
    
    [_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_img.mas_bottom).with.offset(10);
        make.centerX.equalTo(_img.mas_centerX);
        make.right.left.offset(0);
        make.height.mas_equalTo(10);
        
    }];
    _label.alpha = 0.6;
    _label.textAlignment = NSTextAlignmentCenter;

}


- (void)setModel:(ZPBSecondGetModel *)model {

    _model = model;
        [self.img sd_setImageWithURL:[NSURL URLWithString:self.model.picUrl] placeholderImage:nil];
        self.label.text = model.name;
    _label.font = [UIFont systemFontOfSize:15];

}
@end
